package cn.jtfadmin.base.shiro.support;

import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationListener;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.subject.PrincipalCollection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class DefaultAuthenticationListener implements AuthenticationListener {

    private Logger logger = LoggerFactory.getLogger(getClass());
    @Override
    public void onSuccess(AuthenticationToken token, AuthenticationInfo info) {
        logger.debug("登录认证成功:token:{}, AuthenticationInfo", token, info);
    }

    @Override
    public void onFailure(AuthenticationToken token, AuthenticationException ae) {
        logger.warn("登录认证失败:token:{}, ", token, ae);
    }

    @Override
    public void onLogout(PrincipalCollection principals) {
        logger.debug("用户退出:{}", principals);
    }
}
